package com.million.staservice.schedue;


import cn.hutool.core.date.DateUtil;
import com.million.staservice.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author: studyboy
 * @Date: 2022/4/12  9:02
 * 定时器任务
 */
@Component
public class ScheduledTask {

    @Autowired
    private StatisticsDailyService dailyService;

    //每天凌晨一点，把前一天数据进行数据查询添加
    @Scheduled(cron = "0 0 1 * * ? ")
    public void task2(){
        //用hutool 来弄
        //获取昨天
        String yesTerDay = DateUtil.yesterday().toDateStr();
        dailyService.registerCount(yesTerDay);
    }
}
